package engine.newUi
{
	import engine.GameData;
	import engine.data.BindManage;
	import engine.data.ModelLocator;
	import engine.event.SceneEvent;
	import engine.flag.GameDefine;
	import engine.logic.LogSendLogic;
	import engine.logic.SceneTransfer;
	import engine.net.event.CustomMsgEvent;
	import engine.net.messages.CustomToClientFlag;
	import engine.net.messages.CustomToServerFlag;
	import engine.net.mgr.SystemSender;
	import engine.scene.SceneChangeManager;
	import engine.scene.SceneManager;
	import engine.tip.TipsMainLogic;
	import engine.ui.AlertUI;
	import engine.ui.MainUIManager;
	import engine.ui.UIManage;
	import engine.ui.lite.BaseUI;
	
	import flash.display.MovieClip;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	import flash.text.StyleSheet;
	
	import newx.StageInfo;
	import newx.com.config.StaticIni;
	import newx.com.control.button.NxButton;
	import newx.com.control.tab.NxTab;
	import newx.com.control.tab.NxTabEvent;
	import newx.com.control.text.NxText;
	
	/**
	 *	任务跟踪界面 
	 */
	public class TaskTrackingUI extends BaseUI
	{
		public var titleTab			:	NxTab
		public var taskInfoTxt 		:	NxText;
		public var canTaskInfoTxt		:	NxText;
		private var _bindManage 		:	BindManage;
		private var _model 			:	ModelLocator;
		private var _taskLogic 		:	TaskLogic;
		/**
		 * 可接任务
		 */
		private var _canTaskList:Array	=	[]
		/**
		 *	保存需要跟踪进度的任务
		 */
		private var _saveTaskIdList : Array = [];
		/**
		 *	需要过滤的跟踪任务 
		 */
		private var _filterTaskIdList : Array = [];
		/**
		 *	最大跟踪数量 
		 */
		private const MAX_TRACKING_TASK : int = 100;
		/**
		 *	隐藏按钮 
		 */
		public var hideBtn 			:NxButton;
		/**
		 *	任务界面按钮 
		 */
		public var taskBtn 			:MovieClip;
		/**
		 *	是否隐藏任务导航 
		 */
		private var _taskSpace		:Sprite;
		private var _hide 			: Boolean = true;
		private var _config 		: Boolean = true;
		private static var _self 	: TaskTrackingUI;
		/**背景**/
		private var sp				:Shape;
		private var _isVisble		:Boolean= false;
		private var _isPrLine		:Boolean;
		private var _isShowTracking:Boolean	=	true;
		
		private var _completeTask	:String = "";
		
		private var _acceptTask	:String = "";
		
		//主线任务
		private var _importTask	:String = "";
		
		private var _hasImportAcceptTask	:Boolean;
		
		private var _hasImportCompleteTask:Boolean;
		/**
		 * 保存可接人任务
		 */
		private var _TaskIdList:Array = []; 
		public function TaskTrackingUI()
		{
//			init();
		}
		
		public static function getInstance():TaskTrackingUI
		{
			if(_self == null)
			{
				_self =	new TaskTrackingUI();
			}
			return _self;
		}
		
		override public function Init():void
		{
			_taskSpace				=	new Sprite();
			taskInfoTxt.visible		=	true;
			canTaskInfoTxt.visible	=	false;
			addChild(_taskSpace);
			_taskSpace.addChild(taskInfoTxt);
			_taskSpace.addChild(canTaskInfoTxt);
			initText();
			
//			hideBtn.gotoAndStop(1);
			hideBtn.addEventListener(MouseEvent.CLICK,onClick);
			taskInfoTxt.addEventListener(MouseEvent.MOUSE_OVER,onOverHandle);
			taskInfoTxt.addEventListener(MouseEvent.MOUSE_OUT, onOutHandle);
			taskBtn.addEventListener(MouseEvent.CLICK,taskListHandle);
			taskBtn.buttonMode =true;
			taskBtn.addEventListener(MouseEvent.MOUSE_OVER,taskListOverHandle);
			taskBtn.addEventListener(MouseEvent.MOUSE_OUT,taskListOutHandle);
			//hideBtn.x = taskInfoTxt.width - 15;
			
			_taskLogic = new TaskLogic();
			
			_bindManage = BindManage.getInstance();
			
			_model = ModelLocator.getInstance();
			
			_model.addEventListener(SceneEvent.SceneLoaded,configInit);
			SceneTransfer.getInstance();
			titleTab.addEventListener(NxTabEvent.TAB_CLICK, tabClickHandle);
			//可接任务
			_model.addEventListener(String(CustomToClientFlag.SERVER_CUSTOMMSG_TASK_CAN_ACCEPT_LIST), getCanableList);
			titleTab.addItem(StaticIni.getSwfLangStr("Task_CurTask"));//"当前任务"
			titleTab.addItem(StaticIni.getSwfLangStr("Task_AcceptTask"));//"可接任务"
			mouseEnabled = false;
		}
		
		private function tabClickHandle(e:NxTabEvent):void 
		{
//			var taskComp:Array	=	_model.scene.GetRecordEx("Task_Completed").recArr
//				trace("______________________________________")
//				for(var i :int = 0; i < taskComp.length; i++)
//				{
//					trace("Index["+i+"] = "+taskComp[i][0]);
//				}
//				trace("______________________________________")
			switch (e.seleted)
			{
				case 0:
					if (_isShowTracking) 
					{
						taskInfoTxt.visible		=	true;
					}
					else
					{
						taskInfoTxt.visible		=	false;
					}
					canTaskInfoTxt.visible	=	false;
//					LogSendLogic.getInstance().btnClickNumSend(22112);
					break;
				case 1:
					taskInfoTxt.visible		=	false;
					canTaskInfoTxt.visible	=	true;
					SystemSender.getInstance().CustomMsg(CustomToServerFlag.CLIENT_CUSTOMMSG_TASK_CAN_ACCEPT);
//					LogSendLogic.getInstance().btnClickNumSend(22113);
					break;
				default:
			}
		}
		
		private function configInit(evt : SceneEvent) : void
		{
			if(_config){
				_config = false;
				//关闭跟踪
				cancelAllTracking();
				//初始化标题
				showTaskTracking([]);
				_bindManage.BindRecord(_model.scene,"TaskTrackingRec",addTaskTrack,removeTaskTrack);
				_bindManage.BindRecord(_model.scene,"Task_Accepted",updataTaskTrack,updataTaskTrack);
				_bindManage.BindRecord(_model.scene,"Task_Record",updataTaskTrack,updataTaskTrack);
			}
		}
				/**
		 * 可接任务列表
		 * @param	e
		 */
		private function getCanableList(e:CustomMsgEvent):void
		{
			_canTaskList			=	[];
			_TaskIdList				= 	[];
			var taskListArray:Array	=	updateArr(e.pList);
			_TaskIdList = taskListArray ; 
			var maxLen:int	=	12
			maxLen = taskListArray.length > maxLen? maxLen:taskListArray.length; 
			var taskType:String		=	"";
			var taskID:int			=	0;
			var taskName:String		=	"";
			var giveNPC:String		=	"";
			var needLv:int			=	0;
			var prTaskItem:Object	=	{ };
			var taskItemStr:String	=	"";
			_acceptTask = "";
			_isPrLine	=	false;
			_hasImportAcceptTask		=	false;
			/*****/
			
			var arrTask:Array = [] ; 
			for (var i:int = 1; i < maxLen; i+=2) 
			{
				var updateObj :Object = {};  
				taskType	=	taskListArray[i];
				taskID		=	taskListArray[i + 1];
				if (taskType == "1-1")
				{
					prTaskItem	=	StaticIni.getIniObj(String("Jxtask_"+taskID));
					if(prTaskItem == null)
					{
						continue;
					}	
					taskName	=	StaticIni.getSwfLangStr(prTaskItem["Name"]);
					needLv		=	prTaskItem["Level"]
					giveNPC		=	_taskLogic.giveTaskNPC(taskID);
					taskItemStr	=	_taskLogic.getTaskTypeDisp(taskName, taskType);
					taskItemStr	=	StaticIni.getSwfLangStrVar("UIStr_1001104", [taskItemStr]) + " ";
				 	var levelPlay:int	=	_model.scene.Role.getPlayerLevel()
					taskItemStr += levelPlay>= needLv ?"" :"<font color='#FF0000'>(Lv:" + needLv +")</font>";
					taskItemStr += "<br>"
					taskItemStr += "    "+giveNPC;
					/***/
					updateObj["type"] = taskType ; 
					updateObj["name"] = taskItemStr
					/**/
					arrTask.push(updateObj);
//					_canTaskList.push(taskItemStr);
					
					_isPrLine	=	true;
					
					if( _acceptTask == "" && levelPlay >= needLv )
					{
						var startIndex : int =  taskItemStr.indexOf( "event:" ) + 6;
						var endIndex : int = taskItemStr.indexOf( "'", startIndex );
						
						_acceptTask = taskItemStr.substr( startIndex, endIndex - startIndex );
						
						_importTask = _acceptTask;
						
						_hasImportAcceptTask = true;
					}
				}
				else
				{
					taskType	=	taskListArray[i];
					taskID		=	taskListArray[i + 1];
					taskName 	= 	StaticIni.getSwfLangStr("Task_Caption" + taskID);
					giveNPC		=	_taskLogic.giveTaskNPC(taskID);
					taskItemStr	=	_taskLogic.getTaskTypeDisp(taskName, taskType) + "<br>";
					taskItemStr	=	StaticIni.getSwfLangStrVar("UIStr_1001104", [taskItemStr]) + " ";
					taskItemStr +=	"    "+ _taskLogic.giveTaskNPC(taskID) + "<br>";
					/****/
					updateObj["type"] = taskType ; 
					updateObj["name"] = taskItemStr
						
					arrTask.push(updateObj);
//					_canTaskList.push(taskItemStr + "<br>");
				}
			}
			arrTask.sortOn("type") ; 
			updataArr(arrTask);
			
			canTaskInfoTxt.htmlText	=	_canTaskList.join("<br>");
			canTaskInfoTxt.setFilter();
		}
		/**
		 * 
		 * @param arr
		 * @return //////////////////////////////////
		 * 
		 */
		private function updataArr(arr:Array):void
		{
			var i :uint = 0 ; 
			var obj:Object ={}; 
			for(i ; i <arr.length ; i++)
			{
				obj=arr[i] as Object
				_canTaskList.push(obj["name"]); 
			}
			
		}
		/**
		 * 
		 * @param val 暂时可接任务排序
		 * 
		 */
		private function updateArr(arr:Array):Array
		{
			var arrList:Array = new Array(); 
	
			var i :uint = 1 ; 
			for( i ; i <arr.length;i+=2)
			{
				if(arr[i]=="1-1")
				{
					arrList.unshift(arr[i+1])
					arrList.unshift(arr[i])
					
				}else 
				{
					arrList.push(arr[i])
					arrList.push(arr[i+1])
				}
			}
			arrList.unshift(arr[0])
			return arrList;
		}
		/**
		 * 是否显示任务追踪
		 */
		public function set isShowTracking(val:Boolean):void
		{
			_isShowTracking	=	val;
			if (titleTab != null && taskInfoTxt != null) 
			{
				if (titleTab.selected == 0) 
				{
					taskInfoTxt.visible	= val;
				}
			}
			
		}
		/**
		 *	手动添加需要跟踪的任务
		 * @param taskId
		 * 
		 */
		public function addTaskTrack(PropertiesName:String,taskId:*,data:*):void
		{
			if(_saveTaskIdList.length > MAX_TRACKING_TASK){
				AlertUI.showAlert(StaticIni.getSwfLangStr("MessageUI_Notice"),StaticIni.getSwfLangStrVar("UIStr_1000816",[MAX_TRACKING_TASK]));
				return;
			}
			canceFilterTask(taskId[0]);
			autoTrackingTask(taskId[0]);			
			updataTaskTrack(null,null,null);
		}
			
		/**
		 *  取消任务跟踪
		 * @param taskId
		 */
		public function removeTaskTrack(PropertiesName:String,taskId:*,data:*):void
		{
			var index : int = _saveTaskIdList.indexOf(taskId[0]);
			if(index == -1) return;
			_saveTaskIdList.splice(index,1);
			//加入
			_filterTaskIdList.push(taskId[0]);
			
			updataTaskTrack(null,null,null);
		}

		private function initText():void
		{
			canTaskInfoTxt.setFilter(2)
			taskInfoTxt.setFilter(2);
			var txtStyle:StyleSheet	=	new StyleSheet();
			
			txtStyle.setStyle("a:link"		,{color:"#FFFF00",textDecoration:"underline"});
			txtStyle.setStyle("a:visited"	,{color:"#"+StaticIni.getIniVar("Css_a_Task","visited")});
			txtStyle.setStyle("a:hover"	,{color:"#"+StaticIni.getIniVar("Css_a_Task","hover"),textDecoration:"none"});
			
			canTaskInfoTxt.styleSheet = txtStyle;
			taskInfoTxt.styleSheet = txtStyle;
			taskInfoTxt.addLinkClickHandel(onLinkClick);
			canTaskInfoTxt.addLinkClickHandel(onLinkClick);
		}
		
		public function autoLink():void
		{
			onLinkClick( _completeTask );
			
			_completeTask = "";
		}
		
		public function autoAccept():void
		{
			onLinkClick( _acceptTask );
			
			_acceptTask = "";
		}
		
		public function autoAcceptByFb():void
		{
			onLinkClick( _importTask );
		}
		
		/**
		 *	点击超链接 
		 * 
		 */
		private function onLinkClick(val:String):void
		{
			if(val == "") return;
			
			if( GameData.SceneType == GameDefine.SceneType_CS )
			{
				if( SceneManager.getInstance().norSceneView.scenePlayerLogic.hasNpc() )
				{
					GameData.Role.startMove( [ new Point( 2400, 650 ) ]);
					
					return;
				}
			}
			
			MainUIManager.getInstance().autoFoundWay = false;

			if(val.charAt(0)=="@")
			{
				TaskListUI.getInstance().gotoTask(val.slice(1,val.length)+"_0");
			}else if(val.charAt(0) == "#")
			{
				TaskListUI.getInstance().gotoTask(val.slice(1,val.length)+"_0",true);
				SystemSender.getInstance().CustomMsg(CustomToServerFlag.CLIENT_CUSTOMMSG_DAILY_TASK_AUTO, int(val.slice(1,val.length)));
			}
			else if (val.charAt(0) == "$")
			{
				TaskListUI.getInstance().gotoTask(val.slice(1,val.length)+"_2");
			}
			else
			{
				SceneTransfer.getInstance().tranferTo( val );
			}
			LogSendLogic.getInstance().btnClickNumSend(22115);
		}
		private function onClick(evt : MouseEvent):void
		{
			_hide = !_hide;
//			hideBtn.gotoAndStop(_hide ? 1 : 2);
			
			if(_hide)
			{
				_taskSpace.visible	=	true
				taskInfoTxt.addEventListener(MouseEvent.MOUSE_OVER,onOverHandle);
				taskInfoTxt.addEventListener(MouseEvent.MOUSE_OUT,onOutHandle);
			}else
			{
				_taskSpace.visible	=	false
				taskInfoTxt.removeEventListener(MouseEvent.MOUSE_OVER,onOverHandle);
				taskInfoTxt.removeEventListener(MouseEvent.MOUSE_OUT,onOutHandle);
			}
			LogSendLogic.getInstance().btnClickNumSend(22114);
			//updataTaskTrack(null,null,null);
		}
		private function taskListHandle(e:MouseEvent):void
		{
			if( TaskListUI.getInstance().created )
			{
				TaskListUI.getInstance().hide();
				return;
			}
			UIManage.getInstance().requestOpenUI(TaskListUI.getInstance());
			LogSendLogic.getInstance().btnClickNumSend(22111);
		}
		private function taskListOverHandle(e:MouseEvent):void
		{
			(e.currentTarget as MovieClip).gotoAndStop(2);
		}
		private function taskListOutHandle(e:MouseEvent):void
		{
			(e.currentTarget as MovieClip).gotoAndStop(1);
		}
		/**打开任务跟踪*/
		public function showTrackUI():void
		{
			if(_hide)
				onClick(null);
		}
		
		/**
		 *	更新任务进度 
		 * @param PropertiesName
		 * @param PropertiesValue
		 * @param data
		 * 
		 */
		private function updataTaskTrack(PropertiesName:String,PropertiesValue:*,data:*) : void
		{
			
			//NpcIconManage.getInstance().updataTaskList(data);
			taskInfoTxt.setScroll(0);
			taskInfoTxt.htmlText	=	"";
			var taskIdList : Array = [];
			var taskTrackList : Array = [];
			_saveTaskIdList = [];
			
			if(!_hide){
				showTaskTracking(taskTrackList);
//				taskInfoTxt.htmlStr =  	taskTrackList.join("<br>");
//				taskInfoTxt.setFilter();
//				return;
			}
			
			var tSize:int	=	_taskLogic.getTaskInfoRec().recArr.length;
			
			if( tSize == 0 )
			{//没有当前任务
				titleTab.selected = 1;
				//
				ActivitesGroupLogic.getInstance().sepcialIsOk = false ; 
				ActivitesGroupLogic.getInstance().updateActivites(23); 
				return;
			}
			
			_completeTask = "";
			
			_hasImportCompleteTask = false;
			//
			var isok:Boolean = false ; 
			var obj:Object = StaticIni.getIniObj("ActivitesGroupLogic_23")
			for(var i:int = tSize-1 ; i >=0 ; i --)
			{
				var taskCheckItem:Object	=	{};
				var val:Array	=	_taskLogic.getTaskInfoRec().recArr[i];
				
				//任务id
				var taskId : int = val[0];
				// 添加图标 引导
				if(taskId == obj["Task_23"])
				{
					isok = true ;
					ActivitesGroupLogic.getInstance().sepcialIsOk = isok ; 
					ActivitesGroupLogic.getInstance().updateActivites(23); 
				}
				//任务不重复
				if(taskIdList.indexOf(taskId) == -1 && _filterTaskIdList.indexOf(taskId) == -1){
					//任务信息
					var taskInfo : Array = [];
					//任务完成进度
					var taskProgress : String = getTaskProgress(taskId);	
					var trackInfo : String = StaticIni.getSwfLangStr(StaticIni.getIniVar("Track_" + taskId,"NameID"));

						
					if(taskProgress != "" || trackInfo != ""){
						taskProgress = trackInfo + (taskProgress == "" ? taskProgress : "" + taskProgress);
						if(canTracking(taskId)){
							taskProgress = StaticIni.getSwfLangStr(taskProgress);
							taskInfo = _taskLogic.getTaskInfo(taskId);
//							var taskType : String = _taskLogic.getTaskType(taskInfo);
							var taskName : String;
							taskName  =  _taskLogic.getTaskType(taskInfo)
							var trackNpc  : String	= _taskLogic.getTaskNPC(taskId);
							if(taskName == "")
							{
								return;
							} 
							taskName	=	StaticIni.getSwfLangStrVar("UIStr_1001104", [taskName]);
							taskIdList.push(taskId);
							
							//创建自己的Obj用来排序用的
							taskCheckItem["type"]		=	_taskLogic.getTaskTypeKey(taskInfo[2]);
							taskCheckItem["complete"]	=	taskInfo[1];
							//任务完成情况
							var complete : String = _taskLogic.getCompletedSuffix(taskId,taskInfo[1]);
							taskName += complete;
							
							
							if(complete =="" ||complete ==null ||trackNpc == "")
							{
								//taskTrackList.push(StaticIni.getSwfLangStrVar("UIStr_1001247",[taskName, "    " + taskProgress]));
								taskCheckItem["showInfo"]	=	StaticIni.getSwfLangStrVar("UIStr_1001247",[taskName, "    " + taskProgress])
								taskTrackList.push(taskCheckItem);
							}
							else
							{
								//taskTrackList.push(StaticIni.getSwfLangStrVar("UIStr_1000813",[taskName, "", "    " + trackNpc]));
								taskCheckItem["showInfo"]	=	StaticIni.getSwfLangStrVar("UIStr_1000813",[taskName, "", "    " + trackNpc])
								if(taskInfo[2] == "1-20" && taskInfo[1] == 1)
								{
									
								}
								else
								{
									taskTrackList.push(taskCheckItem);
									
									if( _completeTask == "" )
									{
										var startIndex : int =  trackNpc.indexOf( "event:" ) + 6;
										var endIndex : int = trackNpc.indexOf( "'", startIndex );
										
										_completeTask = trackNpc.substr( startIndex, endIndex - startIndex );
									}
									
									
									if( taskCheckItem["type"] == 15 )
									{//主线
										_importTask = _completeTask;
										
										_hasImportCompleteTask = true;
									}
								}

							}
						}	
					}
				}
			} 
			showTaskTracking(getTaskTrackList(taskTrackList));
			if( isok == false )
			{
				ActivitesGroupLogic.getInstance().sepcialIsOk = isok ; 
				ActivitesGroupLogic.getInstance().updateActivites(23); 
			}
		}
		/**
		 * 排序任务列表 
		 * @param val
		 * @return 
		 * 
		 */		
		private function getTaskTrackList(val:Array):Array
		{
			var taskList:Array	=	[];
			val.sortOn(["type","complete"],Array.DESCENDING);
			for(var i:int =0; i < val.length; i++)
			{
				taskList.push(val[i]["showInfo"]);
			}
			return taskList;
		}
		/**
		 *	初始化的时候，取消所有任务追踪 
		 * 
		 */
		private function cancelAllTracking():void
		{
			var tSize:int	=	_taskLogic.getTaskInfoRec().recArr.length;
			
			for(var i:int = 0 ; i< tSize ; i ++)
			{
				var taskId : int = _taskLogic.getTaskInfoRec().recArr[i][0];
				if(_filterTaskIdList.indexOf(taskId) == -1)
				{
					_filterTaskIdList.push(taskId);
				}
			}
		}
		
		/**
		 *	获得进度 
		 * @return 
		 * 
		 */
		public function getTaskProgress(taskId : int):String
		{
			var progressIdList : Array;
			//记录任务进度
			var taskProgress : String = "";
			
			var have : Boolean = false;
			
			var progressList : Array  = [];
			
			var tSize			:int	=	_taskLogic.getTaskProgressRec().recArr.length;
			
			for(var i:int = 0 ; i < tSize ; i ++)
			{
				var val:Array	=	_taskLogic.getTaskProgressRec().recArr[i];
				
				if(val[0] == taskId && !sameTaskProgress(progressList, val))
				{
					progressList.push([val[2],val[3],val[4]]);
					have = true;
					//任务信息
					var taskInfo : Array = [];
					//任务完成进度
					var progress : String  = _taskLogic.resolveTaskProgress(val,true);
					if(progress != "")
					{
						var str:String	=	(val[1]==7)?"":StaticIni.getSwfLangStr( val[2] );
						taskProgress += "    " + str + progress;
						have = true;
					}
				}
			}
			if(!have) return "";
			return taskProgress;
		}
		
		
		
		/**
		 *	同一个任务是否有相同的进度
		 * 
		 */
		private function sameTaskProgress(taskProgressList : Array, taskProgress : Array) : Boolean
		{
			for each(var progress : Array in taskProgressList){
				if(progress[0] == taskProgress[2] && progress[1] == taskProgress[3] && progress[2] == taskProgress[4]){
					return true;
				}
			}
			return false;
		}
		
		/**
		 *	是否跟踪 
		 * @param taskId
		 * @return 
		 * 
		 */
		public function isTracking(taskId : int):Boolean
		{
			return _saveTaskIdList.indexOf(taskId) != -1;
		}
		
		/**
		 * 	是否可以跟踪
		 * @param taskId
		 * @return 
		 * 
		 */
		private function canTracking(taskId : int):Boolean
		{
			autoTrackingTask(taskId);
			return _saveTaskIdList.indexOf(taskId) != -1;
		}
		
		/**
		 *	 需要跟踪的任务(自动)
		 * @param taskId
		 * 
		 */
		private function autoTrackingTask(taskId : int):void
		{
			if(_saveTaskIdList.length < MAX_TRACKING_TASK){
				if(_saveTaskIdList.indexOf(taskId) == -1){
					if(_filterTaskIdList.indexOf(taskId) == -1){
						_saveTaskIdList.push(taskId);
					}
				}
			}
		}
		
		/**
		 * 	取消过滤该任务
		 * @param taskId
		 */
		private function canceFilterTask(taskId : int):void
		{
			var filterIndex : int = _filterTaskIdList.indexOf(taskId);
			if(filterIndex != -1){
				_filterTaskIdList.splice(filterIndex,1);
			}
		}
		
		private function showTaskTracking(taskTrackList : Array):void
		{
			if (taskTrackList.length <=0) 
			{
				titleTab.selected	=	1;
			}
			else
			{
				titleTab.selected	=	0;
				taskInfoTxt.htmlStr =  	taskTrackList.join("<br>");
				taskInfoTxt.setFilter();
			}
		}
		
		private function getTitle() : String
		{
			return StaticIni.getSwfLangStrVar("textcolor", 
				["#BE9C71", StaticIni.getSwfLangStr("UIStr_1000142")]);
		}

		
		public function changeLocation():void
		{
			var gameWidth : int = SceneChangeManager.getGameWidth();
			
			var xPoint : int;
			_isVisble	=	false
			if(_isVisble)
			{
				xPoint	=	gameWidth - width - (gameWidth - StageInfo.rootW) * .5 + 5;
			}else
			{
				xPoint	=	gameWidth - (gameWidth - StageInfo.rootW) * .5 - 12;
			}
			
			//y =	ScenePlayerUI.getInstance().y - 20;
			
			initPosX	=	xPoint - taskInfoTxt.width - 60 ;
			initPosY	=	30;
//			TweenLite.to(this, .5, {x:initPosX});
			x = initPosX;
			
		}
		
		private function onOverHandle(e:MouseEvent):void
		{
			if(_saveTaskIdList.length <= 0)
				return;
			
			sp = new Shape();
			sp.graphics.beginFill(0x000000,.5);
			sp.graphics.drawRect(taskInfoTxt.x, taskInfoTxt.y, taskInfoTxt.width, taskInfoTxt.height);
			sp.graphics.endFill();	
			this.addChildAt(sp,0);
//			TipsManage.showTips(StaticIni.getSwfLangStr("UIStr_1001838"));
			TipsMainLogic.instance.showString(StaticIni.getSwfLangStr("UIStr_1001838"));
		}
		
		private function onOutHandle(e:MouseEvent):void
		{
			if(_saveTaskIdList.length <= 0)
				return;
			this.removeChild(sp);
			sp.graphics.clear();
			sp = null;
//			TipsManage.hideTips();
			TipsMainLogic.instance.hide();
		} 	
		
		public function hasImportTask():Boolean
		{
			return _hasImportAcceptTask || _hasImportCompleteTask
		}
		/**
		 *获取可接任务列表 
		 */		
		public function  TaskIdList(str:String):Boolean
		{
			for (var i:int = 1; i < _TaskIdList.length ; i+=2) 
			{
				var taskID:String		=	_TaskIdList[i + 1];
				if (taskID ==str)
				{
					return true ; 
				}
				
			}
			return false ; 
		}
	}
}